package com.weishi.project.training.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weishi.project.api.vo.HeartRateCountVo;
import com.weishi.project.training.domain.HeartRateCount;
import com.weishi.project.training.mapper.HeartRateCountMapper;
import com.weishi.project.training.service.IHeartRateCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 心率计次数据Service业务层处理
 */
@Service
public class HeartRateCountServiceImpl extends ServiceImpl<HeartRateCountMapper, HeartRateCount> implements IHeartRateCountService {

    @Autowired
    private HeartRateCountMapper heartRateCountMapper;

    /**
     * 查询心率计次数据列表
     */
    @Override
    public List<HeartRateCount> selectHeartRateCountList(HeartRateCount heartRateCount) {
        return heartRateCountMapper.selectHeartRateCountList(heartRateCount);
    }

    @Override
    public List<HeartRateCount> qryCountByChannel(Integer channelId) {
        return heartRateCountMapper.selectCountByChannel(channelId);
    }

    @Override
    public void updateByChannelId(HeartRateCount heart) {
        heartRateCountMapper.updateByChannelId(heart);
    }

    @Override
    public List<HeartRateCount> selectHeartRateCountList(Integer groupId, Integer userId) {
        Map<String,Integer> params = new HashMap<>();
        params.put("groupId",groupId);
        params.put("userId",userId);
        return heartRateCountMapper.selectHeartRateCountByMap(params);
    }

    @Override
    public List<HeartRateCountVo> qryCountBySportsman(int channelId, int sportsmanId) {
        Map<String,Object> params = new HashMap<>();
        params.put("channelId",channelId);
        params.put("userId",sportsmanId);
        return heartRateCountMapper.selectCountBySportsman(params);
    }
}